export default {
  namespaced: true,
  state: {
    moduleACount: 100
  },
  mutations:{
    addACount(state,n){
      console.log('调用mutation')
      state.moduleACount+=n
    }
  },
  actions:{
    // 读取全局的getters
    //第三个参数为当前的getters，第四个参数为 上一级的getters   即  读取全局的getters
    addACountAction({ dispatch,commit, getters, rootGetters },n){
      console.log(getters);
      commit("addACount",n)
      console.log(rootGetters);
    }
  },
  getters:{
    getModuleACount(state,getters, rootState, rootGetters){
      console.log(rootState);
      return state.moduleACount;
    }
  }
}
